package edu.tec.mty.extras.fuzzy;

// Creates a Gauss Function
public class GaussFunction {
	public double sigma = 0.1; //Sigma Square
	public double mean = 0.5; // Mean
	
	//Gauss Function Constructor
	//sigma is relative to width and mean to center
	public GaussFunction(double s, double m) throws Exception {
		if(s <= 0){
			throw new Exception ("Sigma must be higher than 0");
		}
		sigma = s;
		mean = m;
	}
	
	//Evaluation Method, evaluates the function for an input X
	public double evaluate(double x){
		return Math.pow(Math.E, -(Math.pow(x - mean, 2))/(2 * Math.pow(sigma, 2)));	
	}

}
